package com.bsoft.hospitalchs.api;


import com.bsoft.hospitalchs.model.CharacterBean;
import com.bsoft.hospitalchs.model.CharacterResBean;
import com.bsoft.hospitalchs.model.ChildCaseRes;
import com.bsoft.hospitalchs.model.ChildRecordList;
import com.bsoft.hospitalchs.model.InspectBean;
import com.bsoft.hospitalchs.model.PhotoResBean;
import com.bsoft.hospitalchs.model.PicResBean;
import com.bsoft.hospitalchs.model.PicSaveInfoBean;
import com.bsoft.hospitalchs.model.RecordInfo;
import com.bsoft.hospitalchs.model.RecordResBean;
import com.bsoft.hospitalchs.model.SearchBean;
import com.bsoft.hospitalchs.model.SearchListReq;
import com.bsoft.hospitalchs.model.SearchResBean;
import com.bsoft.hospitalchs.model.SearchResList;
import com.google.gson.JsonObject;

import java.io.File;
import java.util.Map;

import okhttp3.RequestBody;
import rx.Observable;
import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;

/**
 * Created by 泅渡者
 * Created on 2017/3/22.
 * Api 线程控制
 */

public class ApiImple extends Api {
    public Observable<File> doVersionFile(String url) {
        return getService().getVersionFile(url).subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread());
    }

    public Observable<JsonObject> doLogin(String urt, String uid, String pwd, String deep, String forceLogon) {
        return applySchedulers(getService().getLogin(urt, uid, pwd, deep, forceLogon));
    }

    public Observable<CharacterResBean> doGetCharacter(CharacterBean characterBean) {
        return applySchedulers(getService().getCharacter(characterBean));
    }

    public Observable<SearchResBean> doGetSearch(SearchBean searchBean) {
        return applySchedulers(getService().getSearch(searchBean));
    }
    public Observable<SearchResList> doGetSearchList(SearchListReq searchBean) {
        return applySchedulers(getService().getSearchList(searchBean));
    }

    public Observable<PicResBean> updateUser(Map<String, RequestBody> photos) {
        return applySchedulers(getService().updateUser(photos));
    }

    public Observable<JsonObject> SavePreflight(InspectBean inspectBean) {
        return applySchedulers(getService().toSavePreflight(inspectBean));
    }

    public Observable<JsonObject> SavePicInfo(PicSaveInfoBean inspectBean) {
        return applySchedulers(getService().toSavePicInfo(inspectBean));
    }
    public Observable<RecordResBean> GetRecordInfo(RecordInfo recordInfo) {
        return applySchedulers(getService().getRecord(recordInfo));
    }
   public Observable<PhotoResBean> GetPhotoInfo(RecordInfo recordInfo) {
        return applySchedulers(getService().getPhotoInfo(recordInfo));
    }
    public Observable<ChildCaseRes> GetCaseList(String s) {
        return applySchedulers(getService().getCaseList(s));
    }
    public Observable<ChildRecordList> getChildList(RecordInfo recordInfo) {
        return applySchedulers(getService().getRecordList(recordInfo));
    }
}
